home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HamCall (April 1991)
/
HAMCALL CD-ROM (Buckmaster)(April 1991).BIN
/
telcom
/
qmodem
/
down.scr
< prev
next >
Wrap
Text File
|
1989-02-20
|
15KB
|
523 lines
;*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*;
; ;
; Script DOWN.SCR (C) The Forbin Project ;
; ;
; Multi-File Download Script for the Forbin Project ;
; PCBoard Bulletin Board (and compatible PCBoard systems ;
; ;
;*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*;
TURNOFF NOISE MUSIC
STRING XFER TMP1 TC TR BC BR BOTSET TOPSET CMD1 RC FNUM SATTR
ASSIGN TC 1 ; Screen window position variables.
ASSIGN TR 1 ; Initialize all to 1
ASSIGN BC 1 ; ...
ASSIGN BR 1 ; ...
GOTO START.001 ; Branch around the subroutines defined.
;---------------------------------------------------------;
; Subroutine GetFileName ;
; ;
; Uses variable RC as a return code ;
; ;
; If a filename is entered, RC is set to 1 ;
; If no filename is entered, RC is set to 0 ;
; ;
; $FNUM is passed in and the valid filenames are stored ;
; in $FNUM's pointer variable. IE, if $FNUM = 2, then ;
; $2 contains the valid filename. ;
; ;
;---------------------------------------------------------;
GetFileName:
ASSIGN RC 0 ; set RC to unsuccessful
COLOR 2 ; set a green color
INCR FNUM ; inc FNUM
DISPLAY "File # $FNUM > " ; prompt for filename # FNUM
DECR FNUM ; dec FNUM back again
COLOR 3 ; set a cyan color
GET TMP1 12 ; read filename in to $TMP1
IF "$TMP1" = "" GO1 ; if not good, goto GO1 label
ASSIGN CMD1 "ASSIGN $FNUM $TMP1" ; set up a variable CMD1
$CMD1 ; now execute it! (a neat trick)
ASSIGN RC 1 ; set RC to successful
GO1: ; the branch around label GO1
RETURN ; return to calling GOSUB
;---------------------------------------------------------;
; Subroutine Set_Top ;
; ;
; Sets the cursor in the top window ifnot already there. ;
; If it needs to be moved, the bottom window cursor ;
; position is saved before the move. ;
; ;
;---------------------------------------------------------;
Set_Top:
IF TOPSET = TRUE STR
ASSIGN BC $WHEREX
ASSIGN BR $WHEREY
WINDOW 1,1,80,14
GOTOXY $TC,$TR
ASSIGN TOPSET TRUE
ASSIGN BOTSET FALSE
STR:
RETURN
;---------------------------------------------------------;
; Subroutine Set_Bottom ;
; ;
; Sets the cursor in the bottom window if not already ;
; there. If it needs to be moved, the top window cursor ;
; position is saved before the move. ;
; ;
;---------------------------------------------------------;
Set_Bottom:
COLOR 7
IF BOTSET = TRUE SBR
ASSIGN TC $WHEREX
ASSIGN TR $WHEREY
WINDOW 1,15,80,$LAST_ROW
GOTOXY $BC,$BR
ASSIGN BOTSET TRUE
ASSIGN TOPSET FALSE
SBR:
RETURN
;---------------------------------------------------------;
; Start of Script DOWN.SCR ;
;---------------------------------------------------------;
START.001:
GETSCR ; save the screen
ASSIGN SATTR $ATTR ; and the original colors
COLOR 12
BOX 38 1 80 8 ; draw a box
COLOR 14
CLRSCR ; clear the box and display instructions
DISPLAYLN " Multi-File Download for PCBoard!"
COLOR 15
DISPLAYLN " "
DISPLAYLN " Instructions:"
COLOR 6
DISPLAYLN " Enter a filename after each prompt."
DISPLAYLN " Maximum of 10 filenames can be entered."
DISPLAY " A blank entry starts the transfers."
;---------------------------------------------------------;
; Prompt for the Transfer protocol to use ;
;---------------------------------------------------------;
COLOR 12 ; set a pleasing color
BOX 53 10 80 24 ; draw a box
COLOR 2 ; select green
CLRSCR ; clear the box
DISPLAY "Protocol > " ; ask for the protocol
COLOR 3 ; display response in cyan
GET 0 12 ; get the response in $0
IF "$0" = "" DONE ; was ENTER alone pressed? goto DONE if so
ASSIGN XFER $0 ; nope, so store in $XFER for later
;---------------------------------------------------------;
; Loop up to 10 times to read the filenames to download ;
;---------------------------------------------------------;
ASSIGN FNUM 0 ; reset a loop counter
LOOP1: ; loop1 position
GOSUB GETFILENAME ; call the GetFileName subroutine
IF "$RC" = "0" GO ; was it successfull? No, then goto GO
INCR FNUM ; Increment the loop counter
IF "$FNUM" >= "10" GO ; greater than or equal to 10? If so, goto GO
GOTO LOOP1 ; nope, branch back to LOOP1
;---------------------------------------------------------;
; Start the transfer of the selected files ;
;---------------------------------------------------------;
GO:
IF "$0" = "" DONE ; if none entered, go to cleanup routine
WINDOW 1,1,80,14 ; setup the upper window
COLOR 2
CLRSCR
GOTOXY 1,14
DISPLAY "═══════════════════════════════════════"
DISPLAY "═══════════════════════════════════════"
GOTOXY 26,1 ; put the headings on the screen
COLOR 15
DISPLAYLN "File Transfer Status Window"
COLOR 14
DISPLAYLN " Number Filename Status"
COLOR 7
;---------------------------------------------------------;
; Go through all 10 entries and display their status ;
;---------------------------------------------------------;
DISPLAY " 1 $0"
GOTOXY 32,3
DISPLAYLN "In Queue"
IF "$1" = "" CONT1
DISPLAY " 2 $1"
GOTOXY 32,4
DISPLAYLN "In Queue"
IF "$2" = "" CONT1
DISPLAY " 3 $2"
GOTOXY 32,5
DISPLAYLN "In Queue"
IF "$3" = "" CONT1
DISPLAY " 4 $3"
GOTOXY 32,6
DISPLAYLN "In Queue"
IF "$4" = "" CONT1
DISPLAY " 5 $4"
GOTOXY 32,7
DISPLAYLN "In Queue"
IF "$5" = "" CONT1
DISPLAY " 6 $5"
GOTOXY 32,8
DISPLAYLN "In Queue"
IF "$6" = "" CONT1
DISPLAY " 7 $6"
GOTOXY 32,9
DISPLAYLN "In Queue"
IF "$7" = "" CONT1
DISPLAY " 8 $7"
GOTOXY 32,10
DISPLAYLN "In Queue"
IF "$8" = "" CONT1
DISPLAY " 9 $8"
GOTOXY 32,11
DISPLAYLN "In Queue"
IF "$9" = "" CONT1
DISPLAY " 10 $9"
GOTOXY 32,12
DISPLAYLN "In Queue"
;---------------------------------------------------------;
; Ok, now, set up the lower window where we can watch ;
; The BBS as the files are transfered! ;
;---------------------------------------------------------;
CONT1:
GOSUB Set_Bottom
CLRSCR
COLOR 15
Timeout 30 DONE
GOSUB Set_Top
GOTOXY 32,3
COLOR 142
DISPLAY "ACTIVE "
;---------------------------------------------------------;
; DO File #1 ;
;---------------------------------------------------------;
t0:
GOSUB Set_Bottom
SEND "^M"
IF "$0" = "" DONE
WAITFOR "Command?"
SEND "d $0 $XFER^M"
WAITFOR " Aborts Transfer"
DELAY 3000
DOWNLD $XFER $DLPATH$0
IF $SUCCESS s0
GOSUB Set_Top
GOTOXY 32,3
COLOR 12
DISPLAY "* Error - retrying *"
GOTO t0:
s0:
GOSUB Set_Top
GOTOXY 32,3
COLOR 10
DISPLAY "* Complete * "
IF "$1" = "" DONE
GOTOXY 32,4
COLOR 142
DISPLAY "ACTIVE "
;---------------------------------------------------------;
; DO File #2 ;
;---------------------------------------------------------;
t1:
GOSUB Set_Bottom
SEND "^M"
WAITFOR "Command?"
SEND "d $1 $XFER^M"
WAITFOR " Aborts Transfer"
DELAY 3000
DOWNLD $XFER $DLPATH$1
IF $SUCCESS s1
GOSUB Set_Top
GOTOXY 32,4
COLOR 12
DISPLAY "* Error - retrying *"
GOTO t1:
s1:
GOSUB Set_Top
GOTOXY 32,4
COLOR 10
DISPLAY "* Complete * "
IF "$2" = "" DONE
GOTOXY 32,5
COLOR 142
DISPLAY "ACTIVE "
;---------------------------------------------------------;
; DO File #3 ;
;---------------------------------------------------------;
t2:
GOSUB Set_Bottom
SEND "^M"
WAITFOR "Command?"
SEND "d $2 $XFER^M"
WAITFOR " Aborts Transfer"
DELAY 3000
DOWNLD $XFER $DLPATH$2
IF $SUCCESS s2
GOSUB Set_Top
GOTOXY 32,5
COLOR 12
DISPLAY "* Error - retrying *"
GOTO t2:
s2:
GOSUB Set_Top
GOTOXY 32,5
COLOR 10
DISPLAY "* Complete * "
IF "$3" = "" DONE
GOTOXY 32,6
COLOR 142
DISPLAY "ACTIVE "
;---------------------------------------------------------;
; DO File #4 ;
;---------------------------------------------------------;
t3:
GOSUB Set_Bottom
SEND "^M"
WAITFOR "Command?"
SEND "d $3 $XFER^M"
WAITFOR " Aborts Transfer"
DELAY 3000
DOWNLD $XFER $DLPATH$3
IF $SUCCESS s3
GOSUB Set_Top
GOTOXY 32,6
COLOR 12
DISPLAY "* Error - retrying *"
GOTO t3:
s3:
GOSUB Set_Top
GOTOXY 32,6
COLOR 10
DISPLAY "* Complete * "
IF "$4" = "" DONE
GOTOXY 32,7
COLOR 142
DISPLAY "ACTIVE "
;---------------------------------------------------------;
; DO File #5 ;
;---------------------------------------------------------;
t4:
GOSUB Set_Bottom
SEND "^M"
WAITFOR "Command?"
SEND "d $4 $XFER^M"
WAITFOR " Aborts Transfer"
DELAY 3000
DOWNLD $XFER $DLPATH$4
IF $SUCCESS s4
GOSUB Set_Top
GOTOXY 32,7
COLOR 12
DISPLAY "* Error - retrying *"
GOTO t4:
s4:
GOSUB Set_Top
GOTOXY 32,7
COLOR 10
DISPLAY "* Complete * "
IF "$5" = "" DONE
GOTOXY 32,8
COLOR 142
DISPLAY "ACTIVE "
;---------------------------------------------------------;
; DO File #6 ;
;---------------------------------------------------------;
t5:
GOSUB Set_Bottom
SEND "^M"
WAITFOR "Command?"
SEND "d $5 $XFER^M"
WAITFOR " Aborts Transfer"
DELAY 3000
DOWNLD $XFER $DLPATH$5
IF $SUCCESS s5
GOSUB Set_Top
GOTOXY 32,8
COLOR 12
DISPLAY "* Error - retrying *"
GOTO t5:
s5:
GOSUB Set_Top
GOTOXY 32,8
COLOR 10
DISPLAY "* Complete * "
IF "$6" = "" DONE
GOTOXY 32,9
COLOR 142
DISPLAY "ACTIVE "
;---------------------------------------------------------;
; DO File #7 ;
;---------------------------------------------------------;
t6:
GOSUB Set_Bottom
SEND "^M"
WAITFOR "Command?"
SEND "d $6 $XFER^M"
WAITFOR " Aborts Transfer"
DELAY 3000
DOWNLD $XFER $DLPATH$6
IF $SUCCESS s6
GOSUB Set_Top
GOTOXY 32,9
COLOR 12
DISPLAY "* Error - retrying *"
GOTO t6:
s6:
GOSUB Set_Top
GOTOXY 32,9
COLOR 10
DISPLAY "* Complete * "
IF "$7" = "" DONE
GOTOXY 32,10
COLOR 142
DISPLAY "ACTIVE "
;---------------------------------------------------------;
; DO File #8 ;
;---------------------------------------------------------;
t7:
GOSUB Set_Bottom
SEND "^M"
WAITFOR "Command?"
SEND "d $7 $XFER^M"
WAITFOR " Aborts Transfer"
DELAY 3000
DOWNLD $XFER $DLPATH$7
IF $SUCCESS s7
GOSUB Set_Top
GOTOXY 32,10
COLOR 12
DISPLAY "* Error - retrying *"
GOTO t7:
s7:
GOSUB Set_Top
GOTOXY 32,10
COLOR 10
DISPLAY "* Complete * "
IF "$8" = "" DONE
GOTOXY 32,11
COLOR 142
DISPLAY "ACTIVE "
;---------------------------------------------------------;
; DO File #9 ;
;---------------------------------------------------------;
t8:
GOSUB Set_Bottom
SEND "^M"
WAITFOR "Command?"
SEND "d $8 $XFER^M"
WAITFOR " Aborts Transfer"
DELAY 3000
DOWNLD $XFER $DLPATH$8
IF $SUCCESS s8
GOSUB Set_Top
GOTOXY 32,11
COLOR 12
DISPLAY "* Error - retrying *"
GOTO t8:
s8:
GOSUB Set_Top
GOTOXY 32,11
COLOR 10
DISPLAY "* Complete * "
IF "$9" = "" DONE
GOTOXY 32,12
COLOR 142
DISPLAY "ACTIVE "
;---------------------------------------------------------;
; DO File #10 ;
;---------------------------------------------------------;
t9:
GOSUB Set_Bottom
SEND "^M"
WAITFOR "Command?"
SEND "d $9 $XFER^M"
WAITFOR " Aborts Transfer"
DELAY 3000
DOWNLD $XFER $DLPATH$9
IF $SUCCESS s9
COLOR 12
GOSUB Set_Top
GOTOXY 32,12
DISPLAY "* Error - retrying *"
GOTO t9:
s9:
GOSUB Set_Top
GOTOXY 32,12
COLOR 10
DISPLAY "* Complete * "
;---------------------------------------------------------;
; The Cleanup code ;
;---------------------------------------------------------;
DONE:
DISPLAYLN " "
COLOR 11
DISPLAY " Press ENTER to Continue "
GET 1 1
PUTSCR
COLOR $SATTR
EXIT